package info.liuxing.okhttp.dns;

import okhttp3.Dns;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

/**
 * CustomDns
 *
 * @author liuxing (SE)
 * @summary CustomDns
 * @Copyright (c) 2017, Lianjia Group All Rights Reserved.
 * @since 2017-12-01 00:21
 */
public class CustomDns implements Dns {

    private static final Logger LOGGER = LoggerFactory.getLogger(CustomDns.class);

    Dns dns = Dns.SYSTEM;

    @Override
    public List<InetAddress> lookup(String hostname) throws UnknownHostException {
        List<InetAddress> inetAddresses = dns.lookup(hostname);

        LOGGER.trace("DNS解析: {}", inetAddresses);

        return inetAddresses;
    }
}
